package com.kmproject.haifu.mvp.ui.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.http.imageloader.glide.ImageConfigImpl;
import com.jess.arms.utils.ArmsUtils;
import com.kmproject.haifu.R;
import com.kmproject.haifu.mvp.model.entity.beans.SecondHandCategoryBean;
import com.kmproject.haifu.mvp.ui.widget.RoundCornerImageView;

import java.util.List;

public class SecondHandCategoryAdapter extends BaseQuickAdapter<SecondHandCategoryBean, BaseViewHolder> {
    ImageLoader glideImage;
    public SecondHandCategoryAdapter(@Nullable List<SecondHandCategoryBean> data) {
        super(R.layout.second_list_catary,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SecondHandCategoryBean item) {
        if (glideImage == null) {
            glideImage = ArmsUtils.obtainAppComponentFromContext(mContext).imageLoader();
        }
        glideImage.loadImage(mContext, ImageConfigImpl.builder().url(item.getIcon())
                .imageView(helper.<ImageView>getView(R.id.second_list_catary_img))
                .build());
         helper.setText(R.id.second_list_catary_txt,item.getName());
    }
}
